package com.pet.api.client;

import com.pet.api.dto.ItemDTO;
import com.pet.api.dto.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@FeignClient("item-service")
public interface ItemClient {
    @GetMapping("/items/query/{id}")
    ItemDTO getItemById(@PathVariable Integer id);

    @GetMapping("/items/queryBatch")
    List<ItemDTO> getItemsByIds(@RequestParam("ids") Collection<Integer> ids);

    @PutMapping("/items/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);

    @PutMapping("/items/stock/append")
    void appendStock(List<OrderDetailDTO> detailDTOList);
}